package com.project.util;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class IntegerChange implements Converter<String,Integer> {
    @Override
    public Integer convert(String source) {
        if (source != null && source.matches("([1-9]\\d*((.\\d+)*))|(0.\\d+)")) {
            return Integer.parseInt(source);
        }
        return null;
    }
}
